[Back]

MacOS X Developer Preview Release Notes Copyright © 1999-2000 by Apple Computer, Inc. All Rights Reserved.

Mac OS X Developer Preview Release Notes:
AppleScript

This file contains release notes for the AppleScript.

AppleScript 1.5

AppleScript 1.5 in Mac OS X is functionally identical to AppleScript 1.4 in Mac OS 9. It is a Component Manager component accessible through the OSA APIs in OSA.h with additional AppleScript-specific APIs in AppleScript.h and ASDebugging.h. It makes extensive use of the Apple Event manager whose APIs are in AppleEvents.h, AEDataModel.h, and associated headers.

AppleScript 1.5 consists of the following files:

OSA and AppleScript components /System/Library/Components/AppleScript.qtx
/System/Library/Components/OSAApplet.qtx
Script Editor /System/Applications/Script Editor.app
Standard Additions /System/Library/ScriptingAdditions/StandardAdditions.osax
Command-line OSA tool /usr/bin/osascript

Differences between AppleScript 1.4 and 1.5

Because of underlying differences between Mac OS 9 and Mac OS X, there will be some characteristic differences in the behavior of AppleScript in Mac OS X. In particular, AppleScript on Mac OS X does not share any data between different applications, which leads to some differences in how terminology and handlers are updated.

Mac OS X will not support Mac OS 9 scripting additions (OSAXen). Because only applications can safely link to CarbonLib on Mac OS 9, scripting additions on 9 must link to InterfaceLib, which is not supported on Mac OS X. Scripting additions for Mac OS X must be shared libraries using Carbon. See Tech Note 1164 for details on how to build scripting additions as shared libraries, then Carbonize normally. Scripting additions built as packages will be supported, but the API is not yet final.

osascript

osascript is a terminal tool that executes scripts and prints the result to stdout.

osascript [-l language] [file...]

File parameters are either text files or compiled script files. Raw text is assumed to be code in the default scripting language, which is normally AppleScript. You can override this by specifying a scripting component name using the -l flag. Multiple files are compiled into a single context, which is then executed. If no file parameters are given, osascript reads from stdin.

Examples:

# echo "2+3" | /usr/bin/osascript
5

# echo 'tell application "Desktop.app" to get window 1' > test
# /usr/bin/osascript test
window "Applications" of application "Desktop.app"

BUGS:

Unimplemented features in AppleScript for DP4

New since DP3

Known bugs in AppleScript for DP4